<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/common/comonFoodSelect.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增供应商食品</title>
	<script type="text/javascript">
		function  custom(obj){
			$("#foodId").val(obj.foodId);
			$("#foodName").val(obj.foodName);
		}
	</script>
	<script type="text/javascript">
		$(document).ready(function(){
			checkNumber("purchasePrice");
			$("#foodName").change(function(){
				var url="${ctx}/provideFood/getList";
				$.get(url,function(data,status){
					if(status=="success"){
						var obj=eval(data);
						var foodName=$("#foodName").val();
						for(var i=0;i<obj.length;i++){
							if(obj[i].foodName==foodName){
								alert(foodName+"已经存在，不能重复添加");
								$("#foodName").val("");
							}
						}
					}
				});
			});
		});
	</script>
	<script type="text/javascript" src="${ctx}/js/checkFrom.js"></script>
</head>
<body>
<hr />
<form action="${ctx }/provideFood/save" method="post">
<table style="width: 300px;margin: auto;">
	<tr>
		<td>供应商ID</td>
		<td><input type="text" name="providerId" readonly value="${providerId}" /></td>
	</tr>
<tr>
	<td>供应商名称</td>
	<td><input type="text" name="providerName" readonly  value="${providerName}"/></td>
</tr>
	<tr>
		<td>食品名称</td>
		<input type="hidden" name="foodId" id="foodId" readonly/>
		<td><input type="text" name="foodName" id="foodName" required readonly/></td>
	</tr>
	<tr>
		<td>报价</td>
		<td><input type="text" name="purchasePrice" required/></td>
	</tr>
	<tr>
		<td>备注</td>
		<td><input type="text" name="remarks" /></td>
	</tr>
	<tr>

	<td></td>
	<td><input type="submit" value="保存"> </td>
</tr>
</table>
</form>
</body>
</html>